#include <stdio.h>
#include <stdlib.h>

int uninitialized_global_var;
int initialized_global_var = 100;

int main(int argc, char *argv[], char *envp[])
{
    printf("Code address:%p\n", main);  // 正文代码
    printf("Initialized Data address:%p\n", &initialized_global_var);  // 已初始化数据
    printf("Uninitialized Data address:%p\n", &uninitialized_global_var);  // 未初始化数据
    int *p = (int*)malloc(sizeof(int));
    printf("Heap address:%p\n", p);  //堆区
    printf("Stack address:%p\n", &p);  // 栈区

    for (int i = 0; i < argc; i++) {
        printf("Command-line Arguments address:%p\n", argv[i]);  // 命令行参数
    }
    
    for (int i = 0; envp[i]; i++) {
        printf("Environment Variables address:%p\n", envp[i]);  // 环境变量
    }
    return 0;
}